import math

# 已知参数
x_max = 150
x_min = 60
h_max = 50

# 计算第一个方程的右边
term1 = x_max + 15
term2 = h_max + 5
rhs1 = math.sqrt(term1**2 + term2**2)

# 计算第二个方程的右边
rhs2 = x_min - 6

# 解方程组：
# l1 + l2 = rhs1
# l1 - l2 = rhs2

# 求解l1和l2
l1 = (rhs1 + rhs2) / 2
l2 = (rhs1 - rhs2) / 2

# 输出结果
print(f"计算结果：")
print(f"第一个方程右边的值: √({term1}² + {term2}²) = {rhs1:.4f}")
print(f"第二个方程右边的值: {x_min} - 6 = {rhs2}")
print(f"求解得到：")
print(f"L1 = {l1:.4f}")
print(f"L2 = {l2:.4f}")

# 验证结果是否为正数
print(f"\n验证：")
print(f"L1是正数: {l1 > 0}")
print(f"L2是正数: {l2 > 0}")

# 验证解是否满足原方程
print(f"验证解是否满足原方程:")
print(f"L1 + L2 = {l1 + l2:.4f} (应等于 {rhs1:.4f})")
print(f"L1 - L2 = {l1 - l2:.4f} (应等于 {rhs2:.4f})")
    